import {
  Body,
  Controller,
  Get,
  Post,
  Query,
  Param,
  Put,
  Delete,
} from '@nestjs/common';
import { UserService } from './user.service';

@Controller('user')
export class UserController {
  constructor(private readonly userService: UserService) {}

  @Get('findOne')
  findUser(@Query() query: any) {
    return this.userService.findUser(query.sid);
  }

  @Post('set')
  setUser(@Body() body: any, @Query() query: any) {
    return this.userService.setUser(query.sid, body);
  }

  @Put(':sid')
  updateUser(@Param('sid') sid: string, @Body() body: any) {
    console.log('Put sid----', sid);
    return this.userService.updateUser(sid, body);
  }

  @Delete(':sid')
  deleteUser(@Param('sid') sid: string) {
    return this.userService.deleteUser(sid);
  }
}
